﻿using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;

namespace RAP.Framework.Libary.ServerCacheManager.CacheProxy
{
  /// <summary>
  /// 进程内内存缓存实现
  /// </summary>
  public class MemoryCache : CacheProxyBase
  {
    public MemoryCache()
      : base()
    {

    }

    private IDictionary _serverCache = new ConcurrentDictionary<string, object>();

    /// <summary>
    /// 
    /// </summary>
    public override IDictionary ServerCache
    {
      get
      {
        return _serverCache;
      }
    }

    /// <summary>
    /// 创建内存缓存对象
    /// </summary>
    /// <param name="key"></param>
    /// <returns></returns>
    protected override IDictionary CreateCacheObject(string key)
    {
      return new MemoryCachedObject(key);
    }
  }
}
